var queue =[];
 function createPlayer (id,name,level){
    return {
        id:id,
        name:name,
        level:level,
        ststus:"waiting"
    }
 }
 function  addToQueue(queue,player){
    queue.push(player);
    console.log(player.name+"已加入队列");
 }
var player1 = createPlayer(1001,"玩家一",20);
var player2 = createPlayer(1002,"玩家二",15);
var player3 = createPlayer(1003,"玩家三",18) ;
addToQueue(queue,player1);
addToQueue(queue,player2);
addToQueue(queue,player3);
console.log(queue);
function matcgPlayers(queue){
    if(queue.length>=2){
        var playerA = queue.shift();
        var playerB = queue.shift();
        console.log("匹配成功" +playerA.name + "VS" +playerB.name)
    }else{
        console.log("队列中没有足够玩家，您只能人机");
    }
}

matcgPlayers(queue);
